#Makefile rules

ENVDIR	= /usr/bin
DEPDIR = .deps

PATH    = $(ENVDIR):/usr/sbin:/usr/bin:/sbin:/bin:
CC	= $(ENVDIR)/gcc
AR      = $(ENVDIR)/ar
RANLIB  = $(ENVDIR)/ranlib

#run:
#export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH

.PHONY: all
all: libsslapi libssluser libsslapistatic main

libsslapi:
	$(CC) -fPIC -shared libsslapi.c -o libsslapi.so 

libssluser:
	$(CC) -fPIC -shared -L./ -lsslapi libssluser.c -o libssluser.so 
	#-L./ -lsslapi

libsslapistatic:
	gcc -o libsslapistatic.o -c libsslapistatic.c
	ar rcs libsslapistatic.a libsslapistatic.o

main:
	gcc main.c -L./ -lssluser -lsslapistatic -o main
	rm libsslapistatic.a

# clean rules
.PHONY: clean
clean: 
	@-rm -rf *.o *.so *.a main

%.o: %.c 
	$(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(DEPDIR)/$(<:.c=.d)


-include $(DEPDIR)/*.d




